-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HBase typeclass #841
base: main
Are you sure you want to change the base?
HBase typeclass #841
Conversation
import java.util.UUID | ||
import scala.annotation.implicitNotFound | ||
import scala.jdk.CollectionConverters.* | ||
sealed trait HBaseType[T] extends Converter[T, Map[String, Array[Byte]], Map[String, Array[Byte]]] { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sealed trait HBaseType[T] extends Converter[T, Map[String, Array[Byte]], Map[String, Array[Byte]]] { | |
sealed trait HBaseType[T] extends Converter[T, Map[String, Array[Byte]], Map[String, Array[Byte]]] { |
Map(k -> toBytes(v)) | ||
} | ||
|
||
// //////////////////////////////////////////////// |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing a comment here or is it just intended as a linebreak?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
linebreak as in the other modules
} | ||
v.getOrElse(p.default) | ||
} | ||
// result is default if all fields are default |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unless I'm misunderstanding the construct
lambda, it looks like result
defaults if even one field is default?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I copied this from the bigtable
module. I don't get either why we use the Value
wrapper. I'd see If I can clean that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #847
primitive[Double](java.lang.Double.BYTES)(_.getDouble)(_.putDouble(_)) | ||
implicit val hbfBoolean: Primitive[Boolean] = | ||
from[Byte](_ == 1)(if (_) 1 else 0) | ||
implicit val hbfUUID: Primitive[UUID] = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice! should we include support for java.time classes as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe in an unsafe package. As there could be several way to store dates (string bytes, ms long bytes, ...), we should not arbitrarily prick one here.
Add
hbase
module to support conversion fromResult
ant toPut
mutation